//
//  ST_PeculiarityCell.swift
//  btvideo
//
//  Created by mac on 2020/1/10.
//  Copyright © 2020 JarvanZhang. All rights reserved.
//

import UIKit
import SwifterSwift


class ST_PeculiarityCell: UICollectionViewCell {
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        contentView.addSubview(cover_image_view)
        contentView.addSubview(content_label)
        
        cover_image_view.snp.makeConstraints { (make) in
            make.left.right.width.equalToSuperview()
            make.height.equalTo(cover_image_view.snp.width)
            make.top.equalToSuperview().offset(15)
        }
        
        content_label.snp.makeConstraints { (make) in
            make.left.right.equalToSuperview()
            make.top.equalTo(cover_image_view.snp.bottom).offset(15)
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
//    MARK: - Properties
    lazy var content_label:UILabel = {
        let control = UILabel.init()
        control.text = ""
        control.textColor = Color.init(hexString: "#333333")
        control.numberOfLines = 0
        control.textAlignment = .center
        control.font = UIFont.systemFont(ofSize: 16, weight: UIFont.Weight.semibold)
        return control
    }()
    
    lazy var cover_image_view:UIImageView = {
        let control = UIImageView()
        control.contentMode = UIView.ContentMode.scaleAspectFill
        control.cornerRadius = 20
        return control
    }()

//    MARK: - Bind Model
    var model = ST_PairsPeculiarity(){
        didSet{
            
            content_label.text = model.name
            
            
            cover_image_view.pin_setImage(from: model.image.compress_image().url, placeholderImage: ST_SwiftConst.shared.fetch_random_place_holder_image())
        }
    }
    
}
